package com.oocl.daobooks.datagen;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.oocl.daobooks.pojo.Book;

public class BookGenerator {

	public static List<Book> getRandomBooks(int count) {
		List<Book> bookList = new ArrayList<>();
		for (int i = 0; i < count; i++) {
			Book b = new Book(i, generateRandomName(), new Date(),
					generateRandomAuthor(), Math.random() * 10 + 50, true,
					"SUN PRESS");
			bookList.add(b);
		}
		return bookList;
	}
	
	private static String generateRandomName() {
		String[] names = { "Java", "C++", "C#", "Python", "HTML", "JavaScript" };
		return names[(int)(Math.random() * names.length)] + " Programming";
	}
	
	private static String generateRandomAuthor() {
		String[] names = { "Mike", "Aaron", "Jack", "Sam", "Richard" };
		return names[(int)(Math.random() * names.length)];
	}
}
